home *** CD-ROM | disk | FTP | other *** search
- #include "Private.h"
-
- /*** Methods ***************************************************************/
-
- ///Bar_New
- F_METHODM(APTR,Bar_New,TagItem)
- {
- struct LocalObjectData *LOD = F_LOD(Class,Obj);
- struct TagItem *Tags = Msg,
- item;
-
- LOD -> p_PreParse = "FP_Bar_PreParse";
- LOD -> AreaData = (FAreaData *) F_Get(Obj,FA_AreaData);
-
- if (F_SUPERDO())
- {
- while (F_DynamicNTI(&Tags,&item,Class))
- switch (item.ti_Tag)
- {
- case FA_Bar_Title: LOD -> Title = (STRPTR)(item.ti_Data); break;
- case FA_Bar_PreParse: LOD -> PreParse = (STRPTR)(item.ti_Data); break;
- }
- return Obj;
- }
- return NULL;
- }
- //+
- ///Bar_Get
- F_METHOD(void,Bar_Get)
- {
- struct LocalObjectData *LOD = F_LOD(Class,Obj);
- struct TagItem *Tags = Msg,
- item;
- BOOL up=FALSE;
-
- while (F_DynamicNTI(&Tags,&item,Class))
- switch (item.ti_Tag)
- {
- case FA_Bar_Title: F_STORE(LOD -> Title); break;
- case FA_Bar_PreParse: F_STORE(LOD -> PreParse); break;
-
- default: up = TRUE;
- }
-
- if (up) F_SUPERDO();
- }
- //+
- ///Bar_Setup
- F_METHOD(ULONG,Bar_Setup)
- {
- struct LocalObjectData *LOD = F_LOD(Class,Obj);
-
- if (F_SUPERDO())
- {
- if (F_Get(_parent,FA_Horizontal)) LOD -> Flags |= FF_Bar_Vertical;
- else LOD -> Flags &= ~FF_Bar_Vertical;
-
- if (LOD -> Title)
- {
- LOD -> PreParse = (STRPTR) F_Do(_app,FM_Application_Resolve,LOD -> p_PreParse,"<pens style=\"glow\">");
-
- LOD -> TD = F_NewObj("TextDisplay",
- FA_TextDisplay_Contents, LOD -> Title,
- FA_TextDisplay_PreParse, LOD -> PreParse,
- FA_TextDisplay_Font, _font,
- TAG_DONE);
-
- if (LOD -> TD)
- {
- return F_Do(LOD -> TD,FM_TextDisplay_Setup,_render);
- }
- }
- return TRUE;
- }
- return FALSE;
- }
- //+
- ///Bar_Cleanup
- F_METHOD(ULONG,Bar_Cleanup)
- {
- struct LocalObjectData *LOD = F_LOD(Class,Obj);
-
- if (LOD -> TD)
- {
- F_Do(LOD -> TD,FM_TextDisplay_Cleanup);
- F_DisposeObj(LOD -> TD); LOD -> TD = NULL;
- }
- return F_SUPERDO();
- }
- //+
- ///Bar_AskMinMax
- F_METHOD(ULONG,Bar_AskMinMax)
- {
- struct LocalObjectData *LOD = F_LOD(Class,Obj);
-
- if (LOD -> Title)
- {
- if ((LOD -> Flags & FF_Bar_Vertical) == FALSE)
- {
- _minh += F_Get(LOD -> TD,FA_TextDisplay_Height);
- }
- }
- else
- {
- if (LOD -> Flags & FF_Bar_Vertical)
- {
- _minw += 2;
- _maxw = _minw;
- }
- else
- {
- _minh += 2;
- _maxh = _minh;
- }
- }
- return F_SUPERDO();
- }
- //+
- ///Bar_Draw
- F_METHODM(void,Bar_Draw,FS_Draw)
- {
- struct LocalObjectData *LOD = F_LOD(Class,Obj);
- struct RastPort *rp;
- ULONG dark,shine;
- UWORD x1,y1,x2,y2,w,h, bw;
-
- rp = _rp;
- x1 = _x; w = _w; x2 = x1 + w - 1; dark = _pens[FV_Pen_Dark];
- y1 = _y; h = _h; y2 = y1 + h - 1; shine = _pens[FV_Pen_Shine];
-
- F_SUPERDO();
-
- if (LOD -> Flags & FF_Bar_Vertical)
- {
- if (w > 2) x1 = w / 2 + x1 - 1;
-
- _APen(dark); _Move(x1,y1); _Draw(x1,y2);
- _APen(shine); _Move(x1+1,y1); _Draw(x1+1,y2);
- }
- else
- {
- if (LOD -> Title)
- {
- FRect rect;
- UWORD td_w;
-
- rect.x1 = x1+10+1; rect.y1 = y1;
- rect.x2 = x2-10-1; rect.y2 = y2;
-
- F_Do(LOD -> TD,FM_Set,
- FA_TextDisplay_Width, rect.x2 - rect.x1 + 1,
- FA_TextDisplay_Height, rect.y2 - rect.y1 + 1,
- TAG_DONE);
-
- td_w = F_Get(LOD -> TD,FA_TextDisplay_Width);
-
- if (td_w == 0)
- {
- goto __done;
- }
-
- bw = (w - 10 - td_w) / 2;
- y1 = (h / 2) + y1;
-
- _APen(shine); _Move(x1,y1); _Draw(x1+bw-1,y1); _Move(x2-bw+1,y1); _Draw(x2,y1);
- _APen(dark); _Move(x1,y1-1); _Draw(x1+bw-1,y1-1); _Move(x2-bw+1,y1-1); _Draw(x2,y1-1);
-
- rect.x1 = x1+bw+5; rect.x2 = x2-bw-5;
-
- F_Do(LOD -> TD,FM_TextDisplay_Draw,&rect);
- }
- else
- {
- __done:
- if (h > 2) y1 = h / 2 + y1 - 1;
-
- _APen(dark); _Move(x1,y1); _Draw(x2,y1);
- _APen(shine); _Move(x1,y1+1); _Draw(x2,y1+1);
- }
- }
- }
- //+
-